;layui.define(['layer', 'form'], function (exports) {
	var layer = layui.layer,
		form = layui.form()
		$ = layui.jquery;

	var pop = {
		bindEvent: function(){
			var _this = this;
			$("body").on('click', '.pop-close-btn',this.closeFrame);
		},
		openFrame: function(openURL) {
			$.ajax({
				type: 'GET',
				url: openURL,
				success: function (data) {
					layer.open({
					  type: 1,
					  title: false,
					  closeBtn: 0, 
					  area: ['85%', '100%'],
					  offset: 'r',
					  anim: 2,
					  isOutAnim: false,
					  content: '<div class="layui-body dsp-pop-body"><div class="pop-close-btn"></div>' + data || '' + '</div>',
					});
				},
				error: function (e) {
					layer.open({
					  type: 1,
					  title: false,
					  closeBtn: 0, 
					  area: ['85%', '100%'],
					  offset: 'r',
					  anim: 2,
					  isOutAnim: false,
					  content: '<div class="layui-body dsp-pop-body"><div class="pop-close-btn"></div></div>',
					});
				}
			});
			this.bindEvent();
		},
		closeFrame: function() {
			layer.closeAll(); 
		},
		refreshParentFrame: function(e){
			layer.closeAll();
			$.pjax.reload('#pjaxContent', {
				maxCacheLength:0,
				cache: false,
				fragment: "#pjaxContent"
			});
		}
	};
	
	exports("pop", pop);
});